<template>
   <div class="produce-in-table-wrap">
    <el-table
      :data="tableData"
      style="width: 100%"
      :border="true"
      :fit="true"
      :stripe="true"
      size="mini"
      align="center">
      <el-table-column
        prop="id"
        label="id"
        min-width="70"
        align="center">
      </el-table-column>

      <el-table-column
        :showOverflowTooltip="true"
        prop="dd_order"
        label="订单号"
        min-width="100"
        align="center">
      </el-table-column>

      <el-table-column
        :showOverflowTooltip="true"
        prop="sc_order"
        label="生产单号"
        min-width="100"
        align="center">
      </el-table-column>

      <el-table-column
        :showOverflowTooltip="true"
        prop="xiadan_created_at"
        label="下单时间"
        min-width="100"
        align="center">
      </el-table-column>

      <el-table-column
        :showOverflowTooltip="true"
        prop="date"
        label="交货日期"
        min-width="100"
        align="center">
      </el-table-column>

      <el-table-column
        :showOverflowTooltip="true"
        prop="customers_nickname"
        label="客户名称"
        min-width="90"
        align="center">
      </el-table-column>

      <el-table-column
        prop="goods_name"
        label="商品名称"
        min-width="100"
        align="center">
      </el-table-column>

      <el-table-column
        :showOverflowTooltip="true"
        prop="goods_model"
        label="商品型号"
        min-width="90"
        align="center">
      </el-table-column>

      <el-table-column
        :showOverflowTooltip="true"
        prop="order_count"
        label="订单数量"
        min-width="70"
        align="center">
      </el-table-column>

      <el-table-column
        :showOverflowTooltip="true"
        prop="production_count"
        label="生产数量"
        min-width="70"
        align="center">
      </el-table-column>

      <el-table-column
        :showOverflowTooltip="true"
        prop="sell_username"
        label="销售员"
        min-width="80"
        align="center">
      </el-table-column>

      <el-table-column
        prop="status"
        label="生产单状态"
        min-width="90"
        align="center">
      </el-table-column>

      <el-table-column label="操作"
      min-width="110"
      align="center">
        <template slot-scope="scope">
          <el-button
            size="mini"
            plain
            type="primary"
            v-if="scope.row.status!=='已入库'"
            @click="ckeck(scope.row)">审核</el-button>
          <el-button
            size="mini"
            plain
            type="primary"
            v-if="scope.row.status==='已入库'"
            @click="ckeck(scope.row)">查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <deleteConfirm v-if="showMask" @closeDelete="closeDelete" @deleteConfirm="deleteConfirm"></deleteConfirm>
  </div>
</template>
<script lang="ts">
import Vue from 'vue';
import Component from 'vue-class-component';
import { Prop, Emit } from 'vue-property-decorator';
import ajaxResquest from '@/api/apiRequest';

@Component({})
export default class ProduceInTable extends Vue {
  @Prop({
    type: Array
  })
  tableData!: any[];
  showMask: boolean = false;
  mounted() {}
  // @Emit('tableEdit')
  ckeck(row: any) {
    console.log(row);
    if(row.status==='等待配料'){
      this.$to('productListWait', {id: row.id});
    }else if (row.status==='开始生产'){
      this.$to('productListStart',{id:row.id,status:'开始生产'})
    }else if(row.status==='生产结束') {
      this.$to('productListStart',{id:row.id,status:'生产完成'})
    }else if(row.status==='已入库'){
      this.$to('productListStart',{id:row.id,status:'已入库'})
    }
  }
}
</script>
<style lang="less">
.produce-in-table-wrap {
  width: 100%;
  overflow: auto;
}
</style>
